<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./lib/vue_2.5.22.js"></script>
    <script src="./lib/vue-router_3.0.2.js"></script>
</head>

<body>
    <pre>
        1、关于router-link 以及to
        创建路由标签时：使用router-link组件来导航
        router-link会被解析成a标签
        to会被解析成href
        2、关于占位符、填充位
        当点击路由标签时，组件发生改变切换时，组件就会填充到这个位置
        路由出口，路由匹配到的组件将渲染在这里

    </pre>
    <div id="app">
        <router-link to="/login">login</router-link>
        <router-link to="/register">register</router-link>
        <router-view></router-view>
    </div>
    <script>
        var Login = {
            template: `
            <h4>登录</h4>
            `
        }
        var Register = {
            template: `
            <h4>注册</h4>
            `
        }
        const router = new VueRouter({
            routes: [{
                path: '/',
                redirect: '/login'
            }, {
                path: '/login',
                component: Login
            }, {
                path: '/register',
                component: Register
            }]
        })
        var vm = new Vue({
            el: '#app',
            router
        })
    </script>
</body>

</html>